﻿namespace Angle.Data
{
    using System.Data.Entity;
    using System.Reflection;

    using Angle.Core;

    using Castle.MicroKernel.Registration;

    using Skymate;
    using Skymate.Engines.DependencyManagement;
    using Skymate.EntityFramework;
    using Skymate.Modules;

    [DependsOn(typeof(AngleCoreModule),typeof(SkymateEntityframeworkModule))]
    public class AngleDataModule:AbpModule
    {
        public override void PreInitialize()
        {
            
        }

        /// <inheritdoc/>
        public override void Initialize()
        {
            IocManager.Register<DbContext, AngleDemoContext>(DependencyLifeStyle.Transient);

            IocManager.IocContainer.Register(
                Classes.FromThisAssembly()
                .Where(t => t.Name.EndsWith("Store"))
                .WithServiceAllInterfaces()
                .LifestyleTransient());

            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
            
        }
    }
}